import Vue from 'vue'

import 'normalize.css/normalize.css'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/zh-TW'

import '@/styles/index.scss'

import App from './App'
import store from './store'
import router from './router'

import '@/icons'
import '@/permission'

Vue.use(ElementUI, { locale })

Vue.config.productionTip = false

// 定义全局自定义指令
Vue.directive('heima', {
  // 被绑定元素插入父节点时调用 --- 指令的生命周期函数，一般用这个
  inserted(el, binding) {
    console.log(el, binding.value)

    if (!store.state.user.userInfo?.roles?.points?.includes(binding.value)) {
      el.remove()
    }
  }
})

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})

